package com.elitedatai.mchtest.map.model.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Arrays;


public enum FlightAreaGeometryTypeEnum {
    // 圆形区域
    CIRCLE("Circle"),

    // 多边形区域
    POLYGON("Polygon"),

    ;

    private final String type;

    FlightAreaGeometryTypeEnum(String type) {
        this.type = type;
    }

    @JsonValue
    public String getType() {
        return type;
    }

    @JsonCreator
    public static FlightAreaGeometryTypeEnum find(String type) {
        return Arrays.stream(values()).filter(typeEnum -> typeEnum.type.equals(type)).findAny()
                .orElseThrow(() -> new RuntimeException("这个类型(" + type + ") 是不支持的"));
    }
}
